home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / CW GUSI 1.6.4 / include / TFileGlob.h < prev    next >
Text File  |  1995-11-05  |  2KB  |  71 lines

  1. /*********************************************************************
  2. Project    :    GUSI                -    Grand Unified Socket Interface
  3. File        :    TFileGlob.h        -    C and C++ routines for wildcard expansion
  4. Author    :    Matthias Neeracher
  5. Language    :    MPW C/C++
  6.  
  7. $Log: TFileSpec.h,v $
  8. *********************************************************************/
  9.  
  10. #ifndef _TFILEGLOB_
  11. #define _TFILEGLOB_
  12.  
  13. #include <TFileSpec.h>
  14.  
  15. #ifdef __cplusplus
  16.  
  17. /************************** The C++ only interface ***************************/
  18.  
  19.  
  20. #if PRAGMA_ALIGN_SUPPORTED
  21. #pragma options align=mac68k
  22. #endif
  23. class TFileGlob : public TFileSpec {
  24. public:
  25.     TFileGlob()                                                            {}
  26.  
  27.     // Construct from TFileGlob
  28.     TFileGlob(const TFileGlob & glob);
  29.  
  30.     // Construct from pattern relative to directory TFileSpec
  31.     TFileGlob(const char * pattern, const TFileSpec * startDir = nil);
  32.     
  33.     Boolean    Valid()                                                    {  return valid; }
  34.     Boolean    Next();
  35. private:
  36.     struct BackTrack {
  37.         short     index;
  38.         short        vRefNum;
  39.         long        parID;
  40.         char *    pattern;
  41.     };
  42.     
  43.     Boolean        valid;
  44.     char             segments;
  45.     char *         patBuf;
  46.     BackTrack *    track;
  47.     
  48.     Boolean    Next(BackTrack * track, int depth, Boolean init = false);
  49. };
  50. #if PRAGMA_ALIGN_SUPPORTED
  51. #pragma options align=reset
  52. #endif
  53.  
  54. typedef TFileGlob * FileGlobRef;
  55.  
  56. extern "C" {
  57. #else
  58. typedef void * FileGlobRef;
  59. #endif
  60.  
  61. /* Routines shared between C and C++ */
  62. FileGlobRef NewFileGlob(const char * pattern);
  63. Boolean       NextFileGlob(FileGlobRef glob);
  64. Boolean        FileGlob2FSSpec(FileGlobRef glob, FSSpec * spec);
  65. void            DisposeFileGlob(FileGlobRef glob);
  66.  
  67. #ifdef __cplusplus
  68. }
  69. #endif
  70. #endif
  71.